package com.smart.manage.service.impl;

import java.util.List;
import com.smart.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smart.manage.mapper.DrugIncomingMapper;
import com.smart.manage.domain.DrugIncoming;
import com.smart.manage.service.IDrugIncomingService;

/**
 * 药品入库信息Service业务层处理
 * 
 * @author lingyao
 * @date 2025-03-05
 */
@Service
public class DrugIncomingServiceImpl implements IDrugIncomingService 
{
    @Autowired
    private DrugIncomingMapper drugIncomingMapper;

    /**
     * 查询药品入库信息
     * 
     * @param incomingId 药品入库信息主键
     * @return 药品入库信息
     */
    @Override
    public DrugIncoming selectDrugIncomingByIncomingId(Long incomingId)
    {
        return drugIncomingMapper.selectDrugIncomingByIncomingId(incomingId);
    }

    /**
     * 查询药品入库信息列表
     * 
     * @param drugIncoming 药品入库信息
     * @return 药品入库信息
     */
    @Override
    public List<DrugIncoming> selectDrugIncomingList(DrugIncoming drugIncoming)
    {
        return drugIncomingMapper.selectDrugIncomingList(drugIncoming);
    }

    /**
     * 新增药品入库信息
     * 
     * @param drugIncoming 药品入库信息
     * @return 结果
     */
    @Override
    public int insertDrugIncoming(DrugIncoming drugIncoming)
    {
        drugIncoming.setCreateTime(DateUtils.getNowDate());
        return drugIncomingMapper.insertDrugIncoming(drugIncoming);
    }

    /**
     * 修改药品入库信息
     * 
     * @param drugIncoming 药品入库信息
     * @return 结果
     */
    @Override
    public int updateDrugIncoming(DrugIncoming drugIncoming)
    {
        drugIncoming.setUpdateTime(DateUtils.getNowDate());
        return drugIncomingMapper.updateDrugIncoming(drugIncoming);
    }

    /**
     * 批量删除药品入库信息
     * 
     * @param incomingIds 需要删除的药品入库信息主键
     * @return 结果
     */
    @Override
    public int deleteDrugIncomingByIncomingIds(Long[] incomingIds)
    {
        return drugIncomingMapper.deleteDrugIncomingByIncomingIds(incomingIds);
    }

    /**
     * 删除药品入库信息信息
     * 
     * @param incomingId 药品入库信息主键
     * @return 结果
     */
    @Override
    public int deleteDrugIncomingByIncomingId(Long incomingId)
    {
        return drugIncomingMapper.deleteDrugIncomingByIncomingId(incomingId);
    }
}
